/**
 * <p>Copyright: Copyright (c) 2014</p>
 * <p>Company: UMP Technology Co. Ltd</p>
 * <p>2014年5月28日</p>
 * @author Zhang Wensheng
 */
package com.xianl.exception;

import com.xianl.common.ConstEC;
import com.xianl.util.PropsUtil;

/**
 * desc: 平台自定义异常类
 * @author Zhang Wensheng
 * date:2014年5月28日
 */
public class BusiException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8207473538474939811L;
	final static String RETCODE_FAIL="9999";
	final static String ERRMSG = "业务处理超时";

	/** 返回码 */
	private String retCode;
	/** 返回消息 */
	private String message;
	
	public BusiException(){
//		super(ERRMSG);
		this.retCode = RETCODE_FAIL;
		this.message = ERRMSG;
	}
	
	public BusiException(Throwable t){
		super(t);
		this.retCode = RETCODE_FAIL;
		this.message = ERRMSG;
	}
	
	public BusiException(ConstEC retCode){
//		super(ERRMSG);
		this.retCode = retCode.getCode();
		this.message = PropsUtil.getMessage(this.retCode, ERRMSG);
	}
	
	public BusiException(ConstEC retCode, String message){
//		super(message);
		this.retCode = retCode.getCode();
		this.message = message;
	}
	public BusiException(String retCode, String message){
//		super(message);
		this.retCode = retCode;
		this.message = message;
	}
	
	public BusiException(ConstEC retCode,String format, Object ... objs){
		this.retCode = retCode.getCode();
		this.message = String.format(format, objs);
	}
	
	public BusiException(ConstEC retCode, Throwable t){
		super(t);
		this.retCode = retCode.getCode();
		this.message = ERRMSG;
	}

	/**
	 * Getter
	 * @return the retCode
	 */
	public String getRetCode() {
		return retCode;
	}

	/**
	 * Getter
	 * @return the message
	 */
	public String getMessage() {
		return message;
	}
}
